package main
import (
"context"
"os"
"os/signal"
"syscall"
"week13/internal/job"
"week13/internal/job/handler"
)
var signs chan os.Signal
var consumer job.ConsumeMessage
func main() {
	signs = make(chan os.Signal, 1)
	ctx, cancel := context.WithCancel(context.Background())
	signal.Notify(signs, syscall.SIGINT, syscall.SIGTERM)
	go func() {
		select {
		case <-signs:
			cancel()
		}
	}()
	handler := handler.SyncItemToCache{}
	consumer =job.NewKafkaConsumer("item-cache",[]string{job.TOPIC_ITEM_CHANGE},handler)
	consumer.Consume(ctx)
}
